package com.zhan.ielts.service;

import org.springframework.web.multipart.MultipartFile;

import com.zhan.frame.core.dao.BaseService;
import com.zhan.ielts.domain.Topic;

import java.util.List;

public interface TopicService extends BaseService<Topic> {

	public boolean handleQuestion(MultipartFile questionFile, String fileFolder, String aliyunFolder, boolean audioFlag);

	public boolean handleAudio(MultipartFile audioFile, String folder, String aliyunFolder);

	public boolean importTopic(MultipartFile file, String folder);
	
	public boolean uploadSingleFile(MultipartFile file, String fileFolder, String aliyunFolder);

	// 替换以前的handleQuestion和handleAudio
	public boolean dealWithQuestion(MultipartFile questionFile) throws Exception;

	/**
	 * 传来的questionFile为zip文件，解压后格式是两文件夹，一个叫zip，放每个topic的audio的zip，命名规则为${part}_${code}_audio.zip例如：part1_078_1.zip
	 * 另一个文件夹叫files,放所有解压后的音频。这个会放到总的zip用，总的zip是app下载全部的功能用，另还需将question的json文件放到部的zip中。
	 * 上传到阿里云后，更新t_topic的audio_url字段即可
	 * @param questionFile
	 * @return
     */
	public boolean dealWithAudio(MultipartFile questionFile) throws Exception;

	public List<String> buildQaJson();

    void deleteTopicCascade(String id) throws Exception;

	void deleteTopicListCascade(String[] ids) throws Exception;
}
